{
 "metadata": {
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.1-final"
  },
  "orig_nbformat": 2,
  "kernelspec": {
   "name": "python3",
   "display_name": "Python 3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2,
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "from pyecharts import options as opts\n",
    "from pyecharts.charts import Grid, Liquid\n",
    "from pyecharts.commons.utils import JsCode"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {},
   "outputs": [
    {
     "output_type": "stream",
     "name": "stderr",
     "text": [
      "C:\\Python3_7_2\\lib\\site-packages\\pyecharts\\charts\\chart.py:14: PendingDeprecationWarning: pyecharts 所有图表类型将在 v1.9.0 版本开始强制使用 ChartItem 进行数据项配置 :)\n  super().__init__(init_opts=init_opts)\n"
     ]
    },
    {
     "output_type": "execute_result",
     "data": {
      "text/plain": [
       "'e:\\\\PycharmOut\\\\SanKey\\\\department_liquid.html'"
      ]
     },
     "metadata": {},
     "execution_count": 38
    }
   ],
   "source": [
    "\n",
    "mul=10\n",
    "y_p=27\n",
    "y_p1=73\n",
    "bias=5\n",
    "f_bias=3\n",
    "f_size=24\n",
    "mp =Liquid(init_opts=opts.InitOpts(width=\"1400px\",height='250px')).add(\n",
    "    \"01美术\",\n",
    "    [0.3254],\n",
    "    center=[f\"{mul*1+bias}%\", f\"{y_p}%\"],\n",
    "    color= [\"#1E90FF\", \"#ffa345\"],\n",
    "    label_opts=opts.LabelOpts(\n",
    "        font_size=f_size,\n",
    "        formatter=JsCode(\n",
    "            \"\"\"function (param) {\n",
    "                    return (Math.floor(param.value * 10000) / 100) + '%';\n",
    "                }\"\"\"\n",
    "        ),\n",
    "        position=\"inside\",\n",
    "\n",
    "    ),\n",
    ").add(\n",
    "    \"02模型\",\n",
    "    [0.3254],\n",
    "    center=[f\"{mul*2+bias}%\", f\"{y_p}%\"],\n",
    "    color= [\"#1E90FF\", \"#ffa345\"],\n",
    "    label_opts=opts.LabelOpts(\n",
    "        font_size=f_size,\n",
    "        formatter=JsCode(\n",
    "            \"\"\"function (param) {\n",
    "                    return (Math.floor(param.value * 10000) / 100) + '%';\n",
    "                }\"\"\"\n",
    "        ),\n",
    "        position=\"inside\",\n",
    "    ),\n",
    ").add(\n",
    "    \"03跟踪\",\n",
    "    [0.3254],\n",
    "    center=[f\"{mul*3+bias}%\", f\"{y_p}%\"],\n",
    "    color= [\"#1E90FF\", \"#ffa345\"],\n",
    "    label_opts=opts.LabelOpts(\n",
    "        font_size=f_size,\n",
    "        formatter=JsCode(\n",
    "            \"\"\"function (param) {\n",
    "                    return (Math.floor(param.value * 10000) / 100) + '%';\n",
    "                }\"\"\"\n",
    "        ),\n",
    "        position=\"inside\",\n",
    "    ),\n",
    ").add(\n",
    "    \"04动画\",\n",
    "    [0.3254],\n",
    "    center=[f\"{mul*4+bias}%\", f\"{y_p}%\"],\n",
    "    color= [\"#1E90FF\", \"#ffa345\"],\n",
    "    label_opts=opts.LabelOpts(\n",
    "        font_size=f_size,\n",
    "        formatter=JsCode(\n",
    "            \"\"\"function (param) {\n",
    "                    return (Math.floor(param.value * 10000) / 100) + '%';\n",
    "                }\"\"\"\n",
    "        ),\n",
    "        position=\"inside\",\n",
    "    ),\n",
    ").add(\n",
    "    \"05场景\",\n",
    "    [0.3254],\n",
    "    center=[f\"{mul*5+bias}%\", f\"{y_p}%\"],\n",
    "    color= [\"#1E90FF\", \"#ffa345\"],\n",
    "    label_opts=opts.LabelOpts(\n",
    "        font_size=f_size,\n",
    "        formatter=JsCode(\n",
    "            \"\"\"function (param) {\n",
    "                    return (Math.floor(param.value * 10000) / 100) + '%';\n",
    "                }\"\"\"\n",
    "        ),\n",
    "        position=\"inside\",\n",
    "    ),\n",
    ").add(\n",
    "    \"06灯光\",\n",
    "    [0.3254],\n",
    "    center=[f\"{mul*6+bias}%\", f\"{y_p}%\"],\n",
    "    color= [\"#1E90FF\", \"#ffa345\"],\n",
    "    label_opts=opts.LabelOpts(\n",
    "        font_size=f_size,\n",
    "        formatter=JsCode(\n",
    "            \"\"\"function (param) {\n",
    "                    return (Math.floor(param.value * 10000) / 100) + '%';\n",
    "                }\"\"\"\n",
    "        ),\n",
    "        position=\"inside\",\n",
    "    ),\n",
    ").add(\n",
    "    \"07特效一\",\n",
    "    [0.3254],\n",
    "    center=[f\"{mul*7+bias}%\", f\"{y_p}%\"],\n",
    "    color= [\"#1E90FF\", \"#ffa345\"],\n",
    "    label_opts=opts.LabelOpts(\n",
    "        font_size=f_size,\n",
    "        formatter=JsCode(\n",
    "            \"\"\"function (param) {\n",
    "                    return (Math.floor(param.value * 10000) / 100) + '%';\n",
    "                }\"\"\"\n",
    "        ),\n",
    "        position=\"inside\",\n",
    "    ),\n",
    ").add(\n",
    "    \"07特效二\",\n",
    "    [0.3254],\n",
    "    center=[f\"{mul*1}%\",  f\"{y_p1}%\"],\n",
    "    color= [\"#1E90FF\", \"#ffa345\"],\n",
    "    label_opts=opts.LabelOpts(\n",
    "        font_size=f_size,\n",
    "        formatter=JsCode(\n",
    "            \"\"\"function (param) {\n",
    "                    return (Math.floor(param.value * 10000) / 100) + '%';\n",
    "                }\"\"\"\n",
    "        ),\n",
    "        position=\"inside\",\n",
    "    ),\n",
    ").add(\n",
    "    \"08合成一\",\n",
    "    [0.3254],\n",
    "    center=[f\"{mul*2}%\", f\"{y_p1}%\"],\n",
    "    color= [\"#1E90FF\", \"#ffa345\"],\n",
    "    label_opts=opts.LabelOpts(\n",
    "        font_size=f_size,\n",
    "        formatter=JsCode(\n",
    "            \"\"\"function (param) {\n",
    "                    return (Math.floor(param.value * 10000) / 100) + '%';\n",
    "                }\"\"\"\n",
    "        ),\n",
    "        position=\"inside\",\n",
    "    ),\n",
    ").add(\n",
    "    \"08合成二\",\n",
    "    [0.3254],\n",
    "    center=[f\"{mul*3}%\", f\"{y_p1}%\"],\n",
    "    color= [\"#1E90FF\", \"#ffa345\"],\n",
    "    label_opts=opts.LabelOpts(\n",
    "        font_size=f_size,\n",
    "        formatter=JsCode(\n",
    "            \"\"\"function (param) {\n",
    "                    return (Math.floor(param.value * 10000) / 100) + '%';\n",
    "                }\"\"\"\n",
    "        ),\n",
    "        position=\"inside\",\n",
    "    ),\n",
    ").add(\n",
    "    \"09包装\",\n",
    "    [0.3254],\n",
    "    center=[f\"{mul*4}%\", f\"{y_p1}%\"],\n",
    "    color= [\"#1E90FF\", \"#ffa345\"],\n",
    "    label_opts=opts.LabelOpts(\n",
    "        font_size=f_size,\n",
    "        formatter=JsCode(\n",
    "            \"\"\"function (param) {\n",
    "                    return (Math.floor(param.value * 10000) / 100) + '%';\n",
    "                }\"\"\"\n",
    "        ),\n",
    "        position=\"inside\",\n",
    "    ),\n",
    ").add(\n",
    "    \"10剪辑\",\n",
    "    [0.3254],\n",
    "    center=[f\"{mul*5}%\", f\"{y_p1}%\"],\n",
    "    color= [\"#1E90FF\", \"#ffa345\"],\n",
    "    label_opts=opts.LabelOpts(\n",
    "        font_size=f_size,\n",
    "        formatter=JsCode(\n",
    "            \"\"\"function (param) {\n",
    "                    return (Math.floor(param.value * 10000) / 100) + '%';\n",
    "                }\"\"\"\n",
    "        ),\n",
    "        position=\"inside\",\n",
    "    ),\n",
    ").add(\n",
    "    \"11调色\",\n",
    "    [0.3254],\n",
    "    center=[f\"{mul*6}%\", f\"{y_p1}%\"],\n",
    "    color= [\"#1E90FF\", \"#ffa345\"],\n",
    "    label_opts=opts.LabelOpts(\n",
    "        font_size=f_size,\n",
    "        formatter=JsCode(\n",
    "            \"\"\"function (param) {\n",
    "                    return (Math.floor(param.value * 10000) / 100) + '%';\n",
    "                }\"\"\"\n",
    "        ),\n",
    "        position=\"inside\",\n",
    "    ),\n",
    ").add(\n",
    "    \"12TD\",\n",
    "    [0.9254],\n",
    "    center=[f\"{mul*7}%\", f\"{y_p1}%\"],\n",
    "    # color= [\"#FF0000\", \"#FF4500\", \"#FF7F00\", \"#ffa345\"],\n",
    "    # color= [\"#FF7F00\", \"#ffa345\"],\n",
    "    color= [\"#1E90FF\", \"#ffa345\"],\n",
    "    # color = \"#FF0000\",\n",
    "    # color = \"#FF7F00\",\n",
    "    # outline_itemstyle_opts={'color':\"#FF7F00\"},\n",
    "    label_opts=opts.LabelOpts(\n",
    "        font_size=f_size,\n",
    "        # color='#fafafa',\n",
    "        formatter=JsCode(\n",
    "            \"\"\"function (param) {\n",
    "                    return (Math.floor(param.value * 10000) / 100) + '%';\n",
    "                }\"\"\"\n",
    "        ),\n",
    "        position=\"inside\",\n",
    "    )\n",
    ").set_global_opts(title_opts=opts.TitleOpts(title=\"各部门工时达标率\"),\n",
    "                     graphic_opts=[ opts.GraphicText(\n",
    "                            graphic_item=opts.GraphicItem(\n",
    "                                left=f\"{mul*1+f_bias}%\", \n",
    "                                top=f\"{y_p-bias*3}%\",\n",
    "                                z=100,),\n",
    "                                # color='#FF7F00',\n",
    "                            graphic_textstyle_opts=opts.GraphicTextStyleOpts(\n",
    "                                # 可以通过jsCode添加js代码，也可以直接用字符串\n",
    "                                text='01美术',\n",
    "                                font=\"14px \",\n",
    "                                #  color='#FF7F00',\n",
    "                                graphic_basicstyle_opts=opts.GraphicBasicStyleOpts(\n",
    "                                    fill=\"#333\")\n",
    "                            )\n",
    "                     ),\n",
    "                     opts.GraphicText(\n",
    "                            graphic_item=opts.GraphicItem(\n",
    "                                left=f\"{mul*2+f_bias}%\", \n",
    "                                top=f\"{y_p-bias*3}%\",\n",
    "                                z=100,),\n",
    "                                # color='#FF7F00',\n",
    "                            graphic_textstyle_opts=opts.GraphicTextStyleOpts(\n",
    "                                # 可以通过jsCode添加js代码，也可以直接用字符串\n",
    "                                text='02模型',\n",
    "                                font=\"14px\",\n",
    "                                #  color='#FF7F00',\n",
    "                                graphic_basicstyle_opts=opts.GraphicBasicStyleOpts(\n",
    "                                    fill=\"#333\")\n",
    "                            )\n",
    "                     ),\n",
    "                     opts.GraphicText(\n",
    "                            graphic_item=opts.GraphicItem(\n",
    "                                left=f\"{mul*3+f_bias}%\", \n",
    "                                top=f\"{y_p-bias*3}%\",\n",
    "                                z=100,),\n",
    "                                # color='#FF7F00',\n",
    "                            graphic_textstyle_opts=opts.GraphicTextStyleOpts(\n",
    "                                # 可以通过jsCode添加js代码，也可以直接用字符串\n",
    "                                text='03跟踪',\n",
    "                                font=\"14px\",\n",
    "                                #  color='#FF7F00',\n",
    "                                graphic_basicstyle_opts=opts.GraphicBasicStyleOpts(\n",
    "                                    fill=\"#333\")\n",
    "                            )\n",
    "                     ),\n",
    "\n",
    "                     opts.GraphicText(\n",
    "                            graphic_item=opts.GraphicItem(\n",
    "                                left=f\"{mul*4+f_bias}%\", \n",
    "                                top=f\"{y_p-bias*3}%\",\n",
    "                                z=100,),\n",
    "                                # color='#FF7F00',\n",
    "                            graphic_textstyle_opts=opts.GraphicTextStyleOpts(\n",
    "                                # 可以通过jsCode添加js代码，也可以直接用字符串\n",
    "                                text='04动画',\n",
    "                                font=\"14px\",\n",
    "                                #  color='#FF7F00',\n",
    "                                graphic_basicstyle_opts=opts.GraphicBasicStyleOpts(\n",
    "                                    fill=\"#333\")\n",
    "                            )\n",
    "                     ),\n",
    "                     opts.GraphicText(\n",
    "                            graphic_item=opts.GraphicItem(\n",
    "                                left=f\"{mul*5+f_bias}%\", \n",
    "                                top=f\"{y_p-bias*3}%\",\n",
    "                                z=100,),\n",
    "                                # color='#FF7F00',\n",
    "                            graphic_textstyle_opts=opts.GraphicTextStyleOpts(\n",
    "                                # 可以通过jsCode添加js代码，也可以直接用字符串\n",
    "                                text='05场景',\n",
    "                                font=\"14px\",\n",
    "                                #  color='#FF7F00',\n",
    "                                graphic_basicstyle_opts=opts.GraphicBasicStyleOpts(\n",
    "                                    fill=\"#333\")\n",
    "                            )\n",
    "                     ),\n",
    "                     opts.GraphicText(\n",
    "                            graphic_item=opts.GraphicItem(\n",
    "                                left=f\"{mul*6+f_bias}%\", \n",
    "                                top=f\"{y_p-bias*3}%\",\n",
    "                                z=100,),\n",
    "                                # color='#FF7F00',\n",
    "                            graphic_textstyle_opts=opts.GraphicTextStyleOpts(\n",
    "                                # 可以通过jsCode添加js代码，也可以直接用字符串\n",
    "                                text='06灯光',\n",
    "                                font=\"14px\",\n",
    "                                #  color='#FF7F00',\n",
    "                                graphic_basicstyle_opts=opts.GraphicBasicStyleOpts(\n",
    "                                    fill=\"#333\")\n",
    "                            )\n",
    "                     ),\n",
    "                     opts.GraphicText(\n",
    "                            graphic_item=opts.GraphicItem(\n",
    "                                left=f\"{mul*7+f_bias}%\", \n",
    "                                top=f\"{y_p-bias*3}%\",\n",
    "                                z=100,),\n",
    "                                # color='#FF7F00',\n",
    "                            graphic_textstyle_opts=opts.GraphicTextStyleOpts(\n",
    "                                # 可以通过jsCode添加js代码，也可以直接用字符串\n",
    "                                text='07特效一',\n",
    "                                font=\"14px\",\n",
    "                                #  color='#FF7F00',\n",
    "                                graphic_basicstyle_opts=opts.GraphicBasicStyleOpts(\n",
    "                                    fill=\"#333\")\n",
    "                            )\n",
    "                     ),\n",
    "                     opts.GraphicText(\n",
    "                            graphic_item=opts.GraphicItem(\n",
    "                                left=f\"{mul*0.5+f_bias}%\", \n",
    "                                top=f\"{y_p1-bias*3}%\",\n",
    "                                z=100,),\n",
    "                                # color='#FF7F00',\n",
    "                            graphic_textstyle_opts=opts.GraphicTextStyleOpts(\n",
    "                                # 可以通过jsCode添加js代码，也可以直接用字符串\n",
    "                                text='07特效二',\n",
    "                                font=\"14px\",\n",
    "                                #  color='#FF7F00',\n",
    "                                graphic_basicstyle_opts=opts.GraphicBasicStyleOpts(\n",
    "                                    fill=\"#333\")\n",
    "                            )\n",
    "                     ),\n",
    "                     opts.GraphicText(\n",
    "                            graphic_item=opts.GraphicItem(\n",
    "                                left=f\"{mul*1.5+f_bias}%\", \n",
    "                                top=f\"{y_p1-bias*3}%\",\n",
    "                                z=100,),\n",
    "                                # color='#FF7F00',\n",
    "                            graphic_textstyle_opts=opts.GraphicTextStyleOpts(\n",
    "                                # 可以通过jsCode添加js代码，也可以直接用字符串\n",
    "                                text='08合成一',\n",
    "                                font=\"14px\",\n",
    "                                #  color='#FF7F00',\n",
    "                                graphic_basicstyle_opts=opts.GraphicBasicStyleOpts(\n",
    "                                    fill=\"#333\")\n",
    "                            )\n",
    "                     ),\n",
    "\n",
    "                     opts.GraphicText(\n",
    "                            graphic_item=opts.GraphicItem(\n",
    "                                left=f\"{mul*2.5+f_bias}%\", \n",
    "                                top=f\"{y_p1-bias*3}%\",\n",
    "                                z=100,),\n",
    "                                # color='#FF7F00',\n",
    "                            graphic_textstyle_opts=opts.GraphicTextStyleOpts(\n",
    "                                # 可以通过jsCode添加js代码，也可以直接用字符串\n",
    "                                text='08合成二',\n",
    "                                font=\"14px\",\n",
    "                                #  color='#FF7F00',\n",
    "                                graphic_basicstyle_opts=opts.GraphicBasicStyleOpts(\n",
    "                                    fill=\"#333\")\n",
    "                            )\n",
    "                     ),\n",
    "\n",
    "                     opts.GraphicText(\n",
    "                            graphic_item=opts.GraphicItem(\n",
    "                                left=f\"{mul*3.5+f_bias}%\", \n",
    "                                top=f\"{y_p1-bias*3}%\",\n",
    "                                z=100,),\n",
    "                                # color='#FF7F00',\n",
    "                            graphic_textstyle_opts=opts.GraphicTextStyleOpts(\n",
    "                                # 可以通过jsCode添加js代码，也可以直接用字符串\n",
    "                                text='09包装',\n",
    "                                font=\"14px\",\n",
    "                                #  color='#FF7F00',\n",
    "                                graphic_basicstyle_opts=opts.GraphicBasicStyleOpts(\n",
    "                                    fill=\"#333\")\n",
    "                            )\n",
    "                     ),\n",
    "                     opts.GraphicText(\n",
    "                            graphic_item=opts.GraphicItem(\n",
    "                                left=f\"{mul*4.5+f_bias}%\", \n",
    "                                top=f\"{y_p1-bias*3}%\",\n",
    "                                z=100,),\n",
    "                            graphic_textstyle_opts=opts.GraphicTextStyleOpts(\n",
    "                                # 可以通过jsCode添加js代码，也可以直接用字符串\n",
    "                                text='10剪辑',\n",
    "                                font=\"14px\",\n",
    "                                graphic_basicstyle_opts=opts.GraphicBasicStyleOpts(\n",
    "                                    fill=\"#333\")\n",
    "                            )\n",
    "                     ),\n",
    "                     opts.GraphicText(\n",
    "                            graphic_item=opts.GraphicItem(\n",
    "                                left=f\"{mul*5.5+f_bias}%\", \n",
    "                                top=f\"{y_p1-bias*3}%\",\n",
    "                                z=100,),\n",
    "                            graphic_textstyle_opts=opts.GraphicTextStyleOpts(\n",
    "                                # 可以通过jsCode添加js代码，也可以直接用字符串\n",
    "                                text='11调色',\n",
    "                                font=\"14px\",\n",
    "                                graphic_basicstyle_opts=opts.GraphicBasicStyleOpts(\n",
    "                                    fill=\"#333\")\n",
    "                            )\n",
    "                     ),\n",
    "                     opts.GraphicText(\n",
    "                            graphic_item=opts.GraphicItem(\n",
    "                                left=f\"{mul*6.5+f_bias}%\", \n",
    "                                top=f\"{y_p1-bias*3}%\",\n",
    "                                z=100,),\n",
    "                            graphic_textstyle_opts=opts.GraphicTextStyleOpts(\n",
    "                                # 可以通过jsCode添加js代码，也可以直接用字符串\n",
    "                                text='12TD',\n",
    "                                font=\"14px\",\n",
    "                                graphic_basicstyle_opts=opts.GraphicBasicStyleOpts(\n",
    "                                    fill=\"#333\")\n",
    "                            )\n",
    "                     ),\n",
    "\n",
    "\n",
    "                     ]\n",
    "                     )\n",
    "                     \n",
    "\n",
    "mp.render(\"department_liquid.html\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ]
}